﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/MasterPage.master" AutoEventWireup="true" CodeFile="ListTeachers.aspx.cs" Inherits="Manage_ListTeachers" %>
<%@ Register Src="~/Manage/CmsMessageBox.ascx" TagPrefix="cms" TagName="MessageBox" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $('#SearchBar').width($('#Body table.List').width());

            
            $('#<%=Delete.ClientID %>').click(function () {
                //判断chkID选中的个数
                if (Cms_CkeckedCount('chkID') == 0) {
                    Cms_MessageBox("请选择将要删除的教师信息。");
                    return false;
                } else {
                    return Cms_Confirm('确认删除当前选中的教师信息吗？');
                }
            });
        });
    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="body" Runat="Server">
    <cms:MessageBox id="MessageBox" runat="server" />
    <asp:HiddenField ID="CurrentPage" runat="server" Value="1" />
    <div id="SearchBar">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td>管理单位：</td>
                <td><asp:DropDownList ID="Departments" runat="server" Width="100px" 
                        AutoPostBack="True" onselectedindexchanged="Departments_SelectedIndexChanged"></asp:DropDownList></td>
                
                <%if (Toolkit.HasPower(Powers.TeacherManager))
                  { %>
                    <td><asp:HyperLink ID="Add" runat="server" NavigateUrl="~/Manage/EditTeacher.aspx" SkinID="AddLink">增加教师</asp:HyperLink></td>
                <%} %>
                
                <%if (Toolkit.HasPower(Powers.TeacherManager)||
                      Toolkit.HasPower(Powers.SystemManager))
                  { %>
                    <td><asp:LinkButton ID="Delete" runat="server" Text="删除教师" SkinID="DeleteButton" onclick="Delete_Click"></asp:LinkButton></td>
                <%} %>
                
                <td><asp:TextBox ID="SearchCondition" runat="server" SkinID="SearchBox" /><asp:HiddenField ID="SearchConditionHidden" runat="server" /></td>
                <td><asp:Button ID="Search" runat="server" Text="查询" onclick="Search_Click"/></td>
            </tr>
        </table>
    </div>
    <div style="clear: both">
        <asp:Repeater ID="RecordView" runat="server">
            <HeaderTemplate>
                <table class="List" cellspacing="1">
                    <tr class="header">
                        <th style="width:50px">操作</th>
                        <th style="width:80px">姓名</th>
                        <th style="width:80px">用户名</th>
                        <th style="width:40px">性别</th>
                        <th style="width:150px">工作单位或家庭住址</th>
                        <th style="width:80px">地域分类</th>
                        <th style="width:70px">学历</th>
                        <th style="width:200px">讲授课程</th>
                        <th style="width:100px">管理单位</th>
                        <th style="width:100px">审核状态</th>
                    </tr>
            </HeaderTemplate>
            <AlternatingItemTemplate>
                <tr class="even">
                    <td align="center" style="width:50px">
                        <input type="checkbox" name="chkID" value='<%#Eval("ID") %>' <%#Convert.ToBoolean(Eval("CanCheck"))?"":"disabled='disabled'"%> />
                    </td>
                    <td align="center" style="width:80px">
                        <asp:HyperLink ID="Edit" runat="server" 
                            NavigateUrl='<%#"~/Manage/EditTeacher.aspx?tid=" + Eval("ID") %>'><%#Eval("Name") %></asp:HyperLink>    
                    </td>
                    <td align="center" style="width:80px"><%#Eval("LoginName") %></td>
                    <td align="center" style="width:40px"><%#Eval("Gender") %></td>
                    <td align="center" style="width:150px"><%#Eval("Units")%></td>
                    <td align="center" style="width:80px"><%#Eval("Rank") %></td>
                    <td align="center" style="width:70px"><%#Eval("Education") %></td>
                    <td style="width:200px"><%#Eval("Course[0]") + (Eval("Course[1]") == "" ? "" : "<br/>其它课程：" + Eval("Course[1]"))%></td>
                    <td align="center" style="width:100px"><%#Eval("Belong") %></td>
                    <td align="center" style="width:100px">
                        <%#(Eval("Verified") == null)?"未审核": (string.Format("<font size='1em'>{0}<br/>{1:yyyy-MM-dd HH:mm}</font>", Eval("Verifier"), Eval("Verified"))) %>
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <ItemTemplate>
                <tr class="odd">
                    <td align="center" style="width:50px">
                        <input type="checkbox" name="chkID" value='<%#Eval("ID") %>' <%#Convert.ToBoolean(Eval("CanCheck"))?"":"disabled='disabled'"%>/>
                    </td>
                    <td align="center" style="width:80px">
                        <asp:HyperLink ID="Edit" runat="server" 
                            NavigateUrl='<%#"~/Manage/EditTeacher.aspx?tid=" + Eval("ID") %>'><%#Eval("Name") %></asp:HyperLink>    
                    </td>
                    <td align="center" style="width:80px"><%#Eval("LoginName") %></td>
                    <td align="center" style="width:40px"><%#Eval("Gender") %></td>
                    <td align="center" style="width:150px"><%#Eval("Units")%></td>
                    <td align="center" style="width:80px"><%#Eval("Rank") %></td>
                    <td align="center" style="width:70px"><%#Eval("Education") %></td>
                    <td style="width:200px"><%#Eval("Course[0]") + (Eval("Course[1]") == "" ? "" : "<br/>其它课程：" + Eval("Course[1]"))%></td>
                    <td align="center" style="width:100px"><%#Eval("Belong") %></td>
                    <td align="center" style="width:100px">
                        <%#(Eval("Verified") == null)?"未审核": (string.Format("<font size='1em'>{0}<br/>{1:yyyy-MM-dd HH:mm}</font>", Eval("Verifier"), Eval("Verified"))) %>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                <tr class="Footer">
                    <td colspan="10" align="center" valign="middle">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td>共 <%=pds.DataSourceCount %> 条记录</td>
                                <td><asp:LinkButton ID="FirstButton" runat="server" SkinID="FirstButton" OnCommand="ChangePage" CommandArgument="F">&nbsp;</asp:LinkButton></td>
                                <td><asp:LinkButton ID="PreviousButton" runat="server" SkinID="PreviousButton" OnCommand="ChangePage" CommandArgument="P">&nbsp;</asp:LinkButton></td>
                                <td>第 <%=pds.CurrentPageIndex+1 %> 页 / 共 <%=pds.PageCount %> 页</td>
                                <td><asp:LinkButton ID="NextButton" runat="server" SkinID="NextButton" OnCommand="ChangePage" CommandArgument="N">&nbsp;</asp:LinkButton></td>
                                <td><asp:LinkButton ID="LastButton" runat="server" SkinID="LastButton" OnCommand="ChangePage" CommandArgument="L">&nbsp;</asp:LinkButton></td>
                                <td><asp:TextBox ID="GotoPage" runat="server" Width="30px"></asp:TextBox></td>
                                <td><asp:LinkButton ID="GotoButton" runat="server" SkinID="GotoButton" OnCommand="ChangePage" CommandArgument="G">&nbsp;</asp:LinkButton></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                </table>
            </FooterTemplate>
        </asp:Repeater>
    </div>
</asp:Content>

